from peewee import *
from datetime import datetime
# db = MySQLDatabase(database='bosszhipin', host='localhost', password='Lxm941202mysql', port=3306, user='root')
db = MySQLDatabase(database='website', host='localhost', password='wearetvxq5', port=3306, user='root')


#搜索记录表
class search_info(Model):
    name = CharField(max_length=256, default='null', index=True)

    updated_at = DateTimeField(default='0000-00-00 00:00:00')
    class Meta:
        database = db

class keywords_list(Model):
    name = CharField(max_length=256, default='null', index=True)

    list = CharField(max_length=256, default='null', index=True)

    class Meta:
        database = db

#招聘信息入库信息
class lagou_post_info(Model):
    md5 = CharField(max_length=256, default='null', index=True)
    post_name = CharField(max_length=256, default='null', index=True)
    salary = CharField(max_length=256, default='null')
    company = CharField(max_length=256, default='null', index=True)
    city = CharField(max_length=256, default='null', index=True)
    industry = CharField(max_length=256, default='null', index=True)
    financing = CharField(max_length=256, default='null')
    company_size = CharField(max_length=256, default='null')
    key_word = CharField(max_length=256, default='null')
    experience = CharField(max_length=256, default='null')
    education = CharField(max_length=256, default='null')
    contact_name = CharField(max_length=256, default='null')
    contact_duties = CharField(max_length=256, default='null')
    contact_photo = CharField(max_length=256, default='null')
    publish_time = CharField(max_length=256, default='null')
    created_at = DateTimeField(default='0000-00-00 00:00:00')
    updated_at = DateTimeField(default='0000-00-00 00:00:00')
    job_desc = TextField(default='null')
    min_code = IntegerField(default='null')
    max_code = IntegerField(default='null')
    class Meta:
        database = db

#连接数据库
# db.connect()
#创建表时如果表已存在会报错，捕获异常直接跳过

# db.create_tables([search_word])
